www.gusucode.com > VC++ 汽配销售管理系统(Access)源码程序 > VC++ 汽配销售管理系统(Access)源码程序/源码/DMain.cpp
//Download by http://www.NewXing.com // DMain.cpp : implementation file // #include "stdafx.h" #include "qpglxt.h" #include "DMain.h" #include "DBaseQuery.h" #include "DMerchandise.h" #include "DPersonnel.h" #include "DComAndGo.h" #include "DStore.h" #include "DUnit.h" #include "DInput.h" #include "DCheck.h" #include "DSellQuery.h" #include "DStoreQuwery.h" #include "DSetup.h" #include "DTotal.h" #include "DBAK.h" #include "DResume.h" #include "DOP.h" #include "externDllHeader.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CDMain dialog extern CQpglxtApp theApp; CDMain::CDMain(CWnd* pParent /*=NULL*/) : CDialog(CDMain::IDD, pParent) { //{{AFX_DATA_INIT(CDMain) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT } void CDMain::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CDMain) // NOTE: the ClassWizard will add DDX and DDV calls here //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CDMain, CDialog) //{{AFX_MSG_MAP(CDMain) ON_WM_PAINT() //}}AFX_MSG_MAP ON_COMMAND(IDM_RCYW_JHDJ, OnJHDJ) ON_COMMAND(IDM_RCYW_THFC,OnTHFC) ON_COMMAND(IDM_RCYW_XSDJ, OnXSDJ) ON_COMMAND(IDM_RCYW_XSTH,OnXSTH) ON_COMMAND(IDM_KCGL_KCCX, OnKCCX) ON_COMMAND(IDM_KCGL_KCPD,OnKCPD) ON_COMMAND(IDM_KCGL_THGL, OnTHGL) ON_COMMAND(IDM_CXTJ_XSCX,OnXSCX) ON_COMMAND(IDM_CXTJ_XSTHCX, OnXSTHCX) ON_COMMAND(IDM_CXTJ_JHCX,OnJHCX) ON_COMMAND(IDM_CXTJ_THFCCX, OnTHFCCX) ON_COMMAND(IDM_CXTJ_XSTJ,OnXSTJ) ON_COMMAND(IDM_JCXX_SPXXGL,OnSPXXGL) ON_COMMAND(IDM_JCXX_WLDWGL, OnWLDWGL) ON_COMMAND(IDM_JCXX_YGXXGL,OnYGXXGL) ON_COMMAND(IDM_JCXX_CKXXGL, OnCKXXGL) // ON_COMMAND(IDM_JCXX_DYXXSZ,OnDYXXSZ) ON_COMMAND(IDM_JCXX_JLDWSZ, OnJLDWSZ) ON_COMMAND(IDM_JCXX_YHXXSZ,OnYHXXSZ) ON_COMMAND(IDM_XTGL_SJBF,OnSJBF) ON_COMMAND(IDM_XTGL_SJHF, OnSJHF) ON_COMMAND(IDM_XTGL_XTSZ,OnXTSZ) ON_COMMAND(IDM_XTGL_CZYGL,OnCZYGL) END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CDMain message handlers void CDMain::OnOK() { // TODO: Add extra validation here //CDialog::OnOK(); } BOOL CDMain::OnInitDialog() { CDialog::OnInitDialog(); int nICO[16]={IDI_ICON1,IDI_ICON1,IDI_ICON2,IDI_ICON3,IDI_ICON3,IDI_ICON4,IDI_ICON5,IDI_ICON6,IDI_ICON6,IDI_ICON7,IDI_ICON8,IDI_ICON9,IDI_ICON9,IDI_ICON10,IDI_ICON10,IDI_ICON11}; this->ShowWindow(SW_SHOWMAXIMIZED); TBBUTTON button[16]; int i=0,nStringLength; CString string; TCHAR * pString; //建立ImageList对象及ToolBar对象 m_ImageList.Create(32,32,ILC_COLOR32|ILC_MASK,0,0); //创建一个图象列表框 m_ToolBar.Create(WS_CHILD|WS_VISIBLE,CRect(0,0,0,0),this,ID_TOOLBAR); //向ImageList对象中添加资源图标 for(i=0;i<16;i++) { m_ImageList.Add(::LoadIcon(::AfxGetResourceHandle(),MAKEINTRESOURCE(nICO[i]))); //向图像列表框中添加图片 } m_ToolBar.SetImageList(&m_ImageList); m_ToolBar.EnableAutomation(); for(i=0;i<16;i++) { button[i].dwData=0; button[i].fsState=TBSTATE_ENABLED; if(i!=1 && i!=4&&i!=8&&i!=12&&i!=14) button[i].fsStyle=TBSTYLE_BUTTON ; else button[i].fsStyle=TBSTYLE_SEP; button[i].iBitmap=i; string.LoadString(i + IDS_STR_TOOLBAR1);//装载字符串资源 //为每一个字符串再加一个'\0',用于向工具栏里加字符串 nStringLength= string.GetLength() + 1; pString = string.GetBufferSetLength(nStringLength); //pString[nStringLength] = 0; //返回刚加的字符串的编号 button[i].iString =m_ToolBar.AddStrings(pString); string.ReleaseBuffer(); } button[0].idCommand=IDM_XTGL_XTSZ; button[2].idCommand=IDM_JCXX_SPXXGL; button[3].idCommand=IDM_JCXX_CKXXGL; button[5].idCommand=IDM_RCYW_JHDJ; button[6].idCommand=IDM_RCYW_XSDJ; button[7].idCommand=IDM_RCYW_XSTH; button[9].idCommand=IDM_KCGL_KCCX; button[10].idCommand=IDM_KCGL_KCPD; button[11].idCommand=IDM_KCGL_THGL; button[13].idCommand=IDM_CXTJ_XSTJ; button[15].idCommand=IDM_XTGL_SJBF; m_ToolBar.AddButtons(16,button); m_ToolBar.AutoSize(); m_ToolBar.SetStyle(TBSTYLE_FLAT|CCS_TOP); this->UpdateWindow(); m_StatusBar.EnableAutomation(); m_StatusBar.Create(WS_CHILD|WS_VISIBLE,CRect(0,0,0,0),this,ID_STATUSBAR); int xpos=::GetSystemMetrics(SM_CXSCREEN); int width[4]; width[1]=xpos*0.2; width[2]=xpos*0.74; width[3]=xpos*0.86; width[4]=xpos; CString sText; sText="操作员:【"+OP+"】"; m_StatusBar.SetParts(4,&width[1]); RxRecordset NameStr; NameStr.Open("系统设置表"); if(NameStr.GetRecordCount()<1) m_StatusBar.SetText("长春市明日科技有限公司",0,SBT_NOBORDERS); else m_StatusBar.SetText(NameStr.GetFieldValue("公司名称"),0,SBT_NOBORDERS); m_StatusBar.SetText(sText,3,SBT_NOBORDERS); this->SetWindowText("汽配销售管理系统V2.02单机版--"+sText); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void CDMain::OnJHDJ() { //进货登记 CDInput dlg; dlg.m_Caption="进货管理"; dlg.DoModal(); } void CDMain::OnTHFC() { //退货返厂 CDInput dlg; dlg.m_Caption="退货返厂管理"; dlg.DoModal(); } void CDMain::OnXSDJ() { CDInput dlg; dlg.m_Caption="销售管理"; dlg.DoModal(); //销售登记 } void CDMain::OnXSTH() { CDInput dlg; dlg.m_Caption="销售退货管理"; dlg.DoModal(); //销售退货 } void CDMain::OnKCCX() { RxRecordset brst; CString sName,stime; CTime ttime; brst.Open("系统设置表"); sName=brst.GetFieldValue("公司名称"); sName=sName+"库存查询报表"; m_ps.MainCaption=sName; m_ps.DeckCaptionNumber=2; ttime=ttime.GetCurrentTime(); stime=CTimeToCString(ttime); m_ps.DeckCaptions[0]="日期:"+stime; m_ps.DeckCaptions[1]="操作员:"+OP; CDStoreQuwery dlg; dlg.DoModal(); //库存查询 } void CDMain::OnKCPD() { CDCheck dlg; dlg.DoModal(); //库存盘点 } void CDMain::OnTHGL() { CDInput dlg; dlg.m_Caption="商品调拨管理"; dlg.DoModal(); //调货管理 } void CDMain::OnXSCX() { //销售查询 CDSellQuery dlg; dlg.SetDateBase("销售查询"); dlg.SetCaption("销售查询"); dlg.DoModal(); } void CDMain::OnXSTHCX() { //销售退货查询 CDSellQuery dlg; dlg.SetDateBase("销售退货查询"); dlg.SetCaption("销售退货查询"); dlg.DoModal(); } void CDMain::OnJHCX() { CDSellQuery dlg; dlg.SetDateBase("进货查询"); dlg.SetCaption("商品进货查询"); dlg.DoModal(); //进货查询 } void CDMain::OnTHFCCX() { CDSellQuery dlg; dlg.SetDateBase("退货返厂查询"); dlg.SetCaption("退货返厂查询"); dlg.DoModal(); //退货返厂查询 } void CDMain::OnXSTJ() { //销售统计 CDTotal dlg; dlg.DoModal(); } void CDMain::OnSPXXGL() { RxRecordset brst; CString sName,stime; CTime ttime; brst.Open("系统设置表"); sName=brst.GetFieldValue("公司名称"); sName=sName+"商品信息报表"; ttime=ttime.GetCurrentTime(); stime=CTimeToCString(ttime); m_ps.MainCaption=sName; m_ps.DeckCaptionNumber=2; ttime=ttime.GetCurrentTime(); stime=CTimeToCString(ttime); m_ps.DeckCaptions[0]="日期:"+stime; m_ps.DeckCaptions[1]="操作员:"+OP; CDMerchandise nextdlg; CDBaseQuery dlg("商品信息查询","商品信息查询",&nextdlg,m_ps); dlg.DoModal(); //商品信息管理 } void CDMain::OnWLDWGL() { RxRecordset brst; CString sName,stime; CTime ttime; brst.Open("系统设置表"); sName=brst.GetFieldValue("公司名称"); sName=sName+"往来单位报表"; m_ps.MainCaption=sName; m_ps.DeckCaptionNumber=2; ttime=ttime.GetCurrentTime(); stime=CTimeToCString(ttime); m_ps.DeckCaptions[0]="日期:"+stime; m_ps.DeckCaptions[1]="操作员:"+OP; CDComAndGo nextdlg; CDBaseQuery dlg("往来单位信息查询","往来单位信息查询",&nextdlg,m_ps); dlg.DoModal(); } void CDMain::OnYGXXGL() { RxRecordset brst; CString sName,stime; CTime ttime; brst.Open("系统设置表"); sName=brst.GetFieldValue("公司名称"); sName=sName+"员工信息报表"; m_ps.MainCaption=sName; m_ps.DeckCaptionNumber=2; ttime=ttime.GetCurrentTime(); stime=CTimeToCString(ttime); m_ps.DeckCaptions[0]="日期:"+stime; m_ps.DeckCaptions[1]="操作员:"+OP; CDPersonnel nextdlg; //员工信息管理 CDBaseQuery dlg("员工信息查询","员工信息表",&nextdlg,m_ps); dlg.DoModal(); } void CDMain::OnCKXXGL() { RxRecordset brst; CString sName,stime; CTime ttime; brst.Open("系统设置表"); sName=brst.GetFieldValue("公司名称"); sName=sName+"仓库信息报表"; m_ps.MainCaption=sName; m_ps.DeckCaptionNumber=2; ttime=ttime.GetCurrentTime(); stime=CTimeToCString(ttime); m_ps.DeckCaptions[0]="日期:"+stime; m_ps.DeckCaptions[1]="操作员:"+OP; CDStore nextdlg; CDBaseQuery dlg("仓库信息查询","仓库信息查询",&nextdlg,m_ps); dlg.DoModal(); //仓库信息管理 } void CDMain::OnJLDWSZ() { CDUnit dlg; dlg.SetCaption("计量单位设置"); dlg.SetDataBase("计量单位表","计量单位","计量单位"); dlg.DoModal(); } void CDMain::OnYHXXSZ() { //银行信息设置 CDUnit dlg; dlg.SetCaption("银行信息设置"); dlg.SetDataBase("银行信息表","名称","银行名称"); dlg.DoModal(); } void CDMain::OnSJBF() { CDBAK dlg; dlg.DoModal(); //数据备份 } void CDMain::OnSJHF() { CDResume dlg; dlg.DoModal(); //数据恢复 } void CDMain::OnCZYGL() { RxRecordset brst; CString sName,stime; CTime ttime; brst.Open("系统设置表"); sName=brst.GetFieldValue("公司名称"); sName=sName+"操作员信息报表"; m_ps.MainCaption=sName; m_ps.DeckCaptionNumber=2; ttime=ttime.GetCurrentTime(); stime=CTimeToCString(ttime); m_ps.DeckCaptions[0]="日期:"+stime; m_ps.DeckCaptions[1]="操作员:"+OP; CDOP nextdlg; CDBaseQuery dlg("操作员信息查询","操作员信息查询",&nextdlg,m_ps); dlg.DoModal(); //操作员设置 } void CDMain::OnXTSZ() { CDSetup dlg; dlg.DoModal(); //系统设置 } void CDMain::OnPaint() { CPaintDC pDC(this); // device context for painting //根据分辩率画背景 CBitmap bit; CDC memDC; CRect rect; this->GetClientRect(&rect); int xpos=::GetSystemMetrics(SM_CXSCREEN); if(xpos==1024) bit.LoadBitmap(IDB_BLK_BIG); else bit.LoadBitmap(IDB_BLK_SML); memDC.CreateCompatibleDC(&pDC); memDC.SelectObject(&bit); pDC.BitBlt(0,50,rect.Width(),rect.Height(),&memDC,0,0,SRCCOPY); memDC.DeleteDC(); ::DeleteObject(&bit); // Do not call CDialog::OnPaint() for painting messages }